<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CSS__/layui.css">
    <link rel="stylesheet" href="__CSS__/view.css"/>
    <link rel="icon" href="/favicon.ico">
    <title>更改账户密码</title>
</head>
<body class="layui-view-body">
    <div class="layui-content">
        <div class="layui-row">
              <div class="layui-card">
                  <form class="layui-form layui-card-body" id="doform">
                    <div class="layui-form-item">
                      <label class="layui-form-label">原密码</label>
                      <div class="layui-input-block">
                        <input type="text" name="pass" required="" lay-verify="required" placeholder="请输入原密码" autocomplete="off" id="pass" value="" class="layui-input">
                      </div>
                    </div>
                    <div class="layui-form-item">
                      <label class="layui-form-label">新密码</label>
                      <div class="layui-input-block">
                        <input type="text" name="repass" required="" lay-verify="required" placeholder="" autocomplete="off" value="" id="repass" class="layui-input">
                      </div>
                    </div>
                    <div class="layui-form-item">
                      <label class="layui-form-label">确认密码</label>
                      <div class="layui-input-block">
                        <input type="text" name="ispass" required="" lay-verify="required" placeholder="" autocomplete="off" value="" id="ispass" class="layui-input">
                      </div>
                    </div>
                    
                    <div class="layui-form-item">
                      <div class="layui-input-block">
                        <a id="formDemo" class="layui-btn layui-btn-blue" lay-submit="" lay-filter="formDemo">保存</a>
                      </div>
                    </div>
                  </form>  
              </div>
        </div>
    </div>
    <script src="__JS__/layui.all.js"></script>
    <script src="__JS__/jquery.min.js"></script>

    <script>
        
        // 修改账户密码
        $('#formDemo').click(function(){
            var urls = "{:Url('Agent/User/updapass')}";
            var data = $('#doform').serialize();

            $.post(urls, data, function(e){
                if(e.error==0){
                    layer.msg(e.msg);
                    setTimeout(function(){
                        // parent.location.reload(); // 刷新父级页面!
                        top.location.href="{:Url('Agent/Login/index')}"; // 跳转父级页面
                        // location.reload();
                    },2500) 
                }else if(e.error==1){
                    layer.msg(e.msg);
                }
            });
        });

    </script>

</body></html>